﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace GameTank3D
{
    public class MenuItem : Dialog
    {
        SpriteBatch spritebatch;
        Texture2D textureNormal;
        Texture2D textureSelect;
        public Vector2 position;
        public Rectangle rectangle;
        bool isSelect = false;
        public Vector2 size;
        public bool IsSelect
        {
            get { return isSelect; }
            set { isSelect = value; }
        }
        public MenuItem(Game game, SpriteBatch sb, Vector2 pos, Texture2D itemtextureNormal, Texture2D itemtextureSelect)
            : base(game)
        {
            // TODO: Construct any child components here
            spritebatch = sb;
            position = pos;
            textureNormal = itemtextureNormal;
            textureSelect = itemtextureSelect;
            size = new Vector2(textureNormal.Width * 2 / 3, textureNormal.Height * 2 / 3);
        }

        public override void Initialize()
        {
            // TODO: Add your initialization code here
            rectangle = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y);
            base.Initialize();
        }

        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here
            rectangle = new Rectangle((int)position.X, (int)position.Y, textureNormal.Width * 2 / 3, textureNormal.Height * 2 / 3);
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            if (isSelect == false)
                spritebatch.Draw(textureNormal, rectangle, Color.White);
            else
                spritebatch.Draw(textureSelect, rectangle, Color.White);
            base.Draw(gameTime);
        }
    }
}
